package com.yiwei.jmx.api.model;

import android.os.Parcel;
import android.os.Parcelable;

import com.yiwei.jmx.api.bean.ResponModel;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by xsooy-pc on 18-10-24.
 */

public class DealIndexDetailModel extends ResponModel implements Parcelable {

    /**
     * data : {"name":"有米贷","company_id":"100","money_max":"30000","money_min":"1000","rate":"24","item":[{"title":"额度高","desc":"最高可借3万"},{"title":"放款快","desc":"申请审核 秒到账"},{"title":"利率低","desc":"日息最低0.04%"}],"banner":"img3.zhixinpai.cn/public/attachment/201606/22/16/20160622161732742.jpg","is_auth":0,"auth_money":0}
     */

    public DataBean data;

    public static class DataBean implements Parcelable {
        /**
         * name : 有米贷
         * company_id : 100
         * money_max : 30000
         * money_min : 1000
         * rate : 24
         * item : [{"title":"额度高","desc":"最高可借3万"},{"title":"放款快","desc":"申请审核 秒到账"},{"title":"利率低","desc":"日息最低0.04%"}]
         * banner : img3.zhixinpai.cn/public/attachment/201606/22/16/20160622161732742.jpg
         * is_auth : 0
         * auth_money : 0
         */
        public String break_fee;
        public String name;
        public String company_id;
        public String manage_fee;
        public String channel_id;
        public String money_max;
        public String money_min;
        public String rate;
        public String lender;
        public String banner;
        public String is_auth;
        public String auth_money;
        public List<ItemBean> item;
        public List<String> days;
        public ArrayList<UseType> use_type;

        public static class ItemBean implements Parcelable {
            /**
             * title : 额度高
             * desc : 最高可借3万
             */

            public String title;
            public String desc;

            @Override
            public int describeContents() {
                return 0;
            }

            @Override
            public void writeToParcel(Parcel dest, int flags) {
                dest.writeString(this.title);
                dest.writeString(this.desc);
            }

            public ItemBean() {
            }

            protected ItemBean(Parcel in) {
                this.title = in.readString();
                this.desc = in.readString();
            }

            public static final Creator<ItemBean> CREATOR = new Creator<ItemBean>() {
                @Override
                public ItemBean createFromParcel(Parcel source) {
                    return new ItemBean(source);
                }

                @Override
                public ItemBean[] newArray(int size) {
                    return new ItemBean[size];
                }
            };
        }

        public static class UseType implements Parcelable {
            /**
             * title : 额度高
             * desc : 最高可借3万
             */

            public String id;
            public String name;

            @Override
            public int describeContents() {
                return 0;
            }

            @Override
            public void writeToParcel(Parcel dest, int flags) {
                dest.writeString(this.id);
                dest.writeString(this.name);
            }

            public UseType() {
            }

            protected UseType(Parcel in) {
                this.id = in.readString();
                this.name = in.readString();
            }

            public static final Creator<UseType> CREATOR = new Creator<UseType>() {
                @Override
                public UseType createFromParcel(Parcel source) {
                    return new UseType(source);
                }

                @Override
                public UseType[] newArray(int size) {
                    return new UseType[size];
                }
            };
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.break_fee);
            dest.writeString(this.name);
            dest.writeString(this.company_id);
            dest.writeString(this.channel_id);
            dest.writeString(this.money_max);
            dest.writeString(this.money_min);
            dest.writeString(this.rate);
            dest.writeString(this.banner);
            dest.writeString(this.is_auth);
            dest.writeString(this.auth_money);
            dest.writeString(this.lender);
            dest.writeString(this.manage_fee);
            dest.writeList(this.item);
            dest.writeStringList(this.days);
            dest.writeList(this.use_type);
        }

        public DataBean() {
        }

        protected DataBean(Parcel in) {
            this.break_fee = in.readString();
            this.name = in.readString();
            this.company_id = in.readString();
            this.channel_id = in.readString();
            this.money_max = in.readString();
            this.money_min = in.readString();
            this.rate = in.readString();
            this.banner = in.readString();
            this.is_auth = in.readString();
            this.auth_money = in.readString();
            this.lender = in.readString();
            this.manage_fee = in.readString();
            this.item = new ArrayList<ItemBean>();
            in.readList(this.item, ItemBean.class.getClassLoader());
            this.days = in.createStringArrayList();
            this.use_type = new ArrayList<UseType>();
            in.readList(this.use_type, UseType.class.getClassLoader());
        }

        public static final Creator<DataBean> CREATOR = new Creator<DataBean>() {
            @Override
            public DataBean createFromParcel(Parcel source) {
                return new DataBean(source);
            }

            @Override
            public DataBean[] newArray(int size) {
                return new DataBean[size];
            }
        };
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeParcelable(this.data, flags);
    }

    public DealIndexDetailModel() {
    }

    protected DealIndexDetailModel(Parcel in) {
        this.data = in.readParcelable(DataBean.class.getClassLoader());
    }

    public static final Parcelable.Creator<DealIndexDetailModel> CREATOR = new Parcelable.Creator<DealIndexDetailModel>() {
        @Override
        public DealIndexDetailModel createFromParcel(Parcel source) {
            return new DealIndexDetailModel(source);
        }

        @Override
        public DealIndexDetailModel[] newArray(int size) {
            return new DealIndexDetailModel[size];
        }
    };
}
